import type { DepartData, Image, OrderParams, OrderPreData, OrderPreParams, PayParams } from '@/types/consult'
import { request } from "@/utils/http"
// 医生科室列表
export const departmentListApi = () => {
  return request.get<null, DepartData[]>('/dep/all')
}

// 上传图片
export const uploadImgApi = (filePath: string) => {
  return request.upload<null, Image>('/upload', {
    filePath,
    name: 'file'
  })
}
/**
 * 根据问诊类型获取预支付信息
 */
export const preOrderApi = (params: OrderPreParams) => {
  return request.get<null, OrderPreData>('/patient/consult/order/pre', { params })
}
/**
 * 根据收集信息生成订单
 * @param data 收集的数据对象
 * @returns 
 */
export const createOrderApi = (data: OrderParams)=>{
  return request.post<null,{id:string}>('/patient/consult/order', data)
}

/**
 * 三方支付（暂时只支持支付宝支付）
 */
export const orderPayApi = (data: PayParams) => {
  return request.post<null, {payUrl:string}>('/patient/consult/pay', data)
}